
ITEM.base = nil
ITEM.isbase = true
ITEM.class = "base"
ITEM.label = "Base"
ITEM.description = "The base item.\nCould be used to make a working item..."
ITEM.model = ""
ITEM.icon = "wintersurvival/icon_bugbait"
ITEM.quantity = 1
ITEM.weight = 0

ITEM.burnable = true
ITEM.drawcolor = Color(255,255,255,255)

//Helper

function ITEM:getDatTab(pl)
	//TODO: Delete DatTab on depletion
	local GM = gmod.GetGamemode()
	
	if SERVER then
		return GM.pldat[pl:UniqueID()][self.class],GM.pldat[pl:UniqueID()]
	else
		if pl ~= LocalPlayer() then
			return false,false
		end
		return GM.invdat[self.class],GM.invdat
	end
end

function ITEM:onBurned(time)
	if time > 5 then
		return self.burnable
	end
	return false
end

//Inventory

function ITEM:onGetIconTexID()
	self.texid = self.texid or surface.GetTextureID(self.icon)
	return self.texid
end

function ITEM:onInvPaint(x,y,w,h,alpha,args)
	local args = args or {}
	local GM = gmod.GetGamemode()
	local alpha = alpha or 1
	
	self.texid = self.texid or surface.GetTextureID(self.icon)
	surface.SetTexture(self.texid)
	surface.SetDrawColor(self.drawcolor.r,self.drawcolor.g,self.drawcolor.b,self.drawcolor.a*alpha)
	surface.DrawTexturedRect(x,y,w,h)
	
	local qty = GM.inv[self.class]
	qty = args.quantity or (qty and qty.quantity or 1)
	if qty and qty > 1 and not args.noquantity then
		draw.DrawText(tostring(qty),"Trebuchet24",x+w-4,y+h-24,Color(255,255,255,255*alpha),2)
	end
end

function ITEM:onInvUsable(pl)
	return false //is usable
end
function ITEM:onInvUse(pl)
	return false //false for do not consume, number for quantity consumed
end

function ITEM:onInvDestroy(pl)
	return true //allow destruction
end

function ITEM:onInvUnSelect(pl)
	return true //allow selection
end

function ITEM:onInvSelect(pl)
	return true //allow unselection
end

//World

function ITEM:onPickup(pl)
	return true //allow pickup
end

function ITEM:onDrop(pl)
	return true //allow drop
end

//Weapon

function ITEM:onThink(pl)
end

function ITEM:onViewModelDrawn(pl)
end

function ITEM:onPrimary(pl)
end

function ITEM:onSecondary(pl)
end

function ITEM:onScroll(delta) //Clientside and LocalPlayer only
	return false
end
